home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PsL Monthly 1993 December
/
PSL Monthly Shareware CD-ROM (December 1993).iso
/
prgmming
/
dos
/
c
/
bor_ti.exe
/
TI1151.ASC
< prev
next >
Wrap
Text File
|
1992-11-04
|
4KB
|
265 lines
PRODUCT : Borland C++ NUMBER : 1151
VERSION : 3.1
OS : ALL
DATE : November 4, 1992 PAGE : 1/4
TITLE : The source code for the new and delete operators.
/*-----------------------------------------------------------------------*
* filename - new.cpp
* C++ NEW
*-----------------------------------------------------------------------*/
/*
* C/C++ Run Time Library - Version 5.0
*
* Copyright (c) 1990, 1992 by Borland International
* All Rights Reserved.
*
*/
#include <stddef.h>
#include <stdlib.h>
typedef void (* pvf)();
pvf _new_handler;
pvf set_new_handler(pvf p)
{
pvf t = _new_handler;
_new_handler = p;
return t;
}
void *operator new( size_t size )
{
void * p;
size = size ? size : 1;
while ( (p = malloc(size)) == NULL && _new_handler != NULL)
_new_handler();
return p;
}
/*-----------------------------------------------------------------------*
* filename - newf.cpp
* C++ NEW
PRODUCT : Borland C++ NUMBER : 1151
VERSION : 3.1
OS : ALL
DATE : November 4, 1992 PAGE : 2/4
TITLE : The source code for the new and delete operators.
*-----------------------------------------------------------------------*/
/*
* C/C++ Run Time Library - Version 5.0
*
* Copyright (c) 1990, 1992 by Borland International
* All Rights Reserved.
*
*/
#include <stddef.h>
#include <alloc.h>
typedef void (*pvf)();
extern pvf _new_handler;
void far * operator new( unsigned long size )
{
void far * p;
size = size ? size : 1;
while ( (p = farmalloc(size)) == NULL && _new_handler !=
NULL)
_new_handler();
return p;
}
/*-----------------------------------------------------------------------*
* filename - del.cpp
* C++ DELETE
*-----------------------------------------------------------------------*/
/*
* C/C++ Run Time Library - Version 5.0
*
* Copyright (c) 1990, 1992 by Borland International
* All Rights Reserved.
*
*/
PRODUCT : Borland C++ NUMBER : 1151
VERSION : 3.1
OS : ALL
DATE : November 4, 1992 PAGE : 3/4
TITLE : The source code for the new and delete operators.
#include <stddef.h>
#include <stdlib.h>
void operator delete( void _FAR *ptr )
{
free(ptr);
}
/*-----------------------------------------------------------------------*
* filename - delf.cpp
* C++ DELETE
*-----------------------------------------------------------------------*/
/*
* C/C++ Run Time Library - Version 5.0
*
* Copyright (c) 1990, 1992 by Borland International
* All Rights Reserved.
*
*/
#include <stddef.h>
#include <alloc.h>
#include <dos.h>
#if defined(__TINY__) || defined(__SMALL__) ||
defined(__MEDIUM__)
void operator delete( void far *ptr )
{
if (FP_SEG(ptr) == _DS)
free((void *) ptr);
else
farfree(ptr);
}
#endif
DISCLAIMER: You have the right to use this technical information
subject to the terms of the No-Nonsense License Statement that
PRODUCT : Borland C++ NUMBER : 1151
VERSION : 3.1
OS : ALL
DATE : November 4, 1992 PAGE : 4/4
TITLE : The source code for the new and delete operators.
you received with the Borland product to which this information
pertains.